package com.gitee.ywj1352.stream.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.kafka.core.KafkaTemplate;
import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class MessageController {

    @Autowired
    private KafkaTemplate kafkaTemplate;

    @GetMapping("msg")
    public String send(@RequestParam String msg) throws  Exception{
        ListenableFuture send = kafkaTemplate.send("test-1", msg);
        return send.get().toString();
    }


}
